package com.zjdiepu.www.commpent.mapper.cw;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.ibiz.cache.ICachedDictionaryService;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.cw.dto.CwIncomeExpensesItem;
/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：CwIncomeExpensesItemMapper <br/>  
 * 类描述：字段转换 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月25日 下午5:51:41  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月25日 下午5:51:41   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class CwIncomeExpensesItemVoMapper extends BaseMapper<CwIncomeExpensesItem>{
	@Resource
	private ICachedDictionaryService cachedDictionaryService;
	@Resource
	private RedisObjectClient redisObjectClient;
	
	@Override
	public void mapper(RedisConnection redisConnection,CwIncomeExpensesItem m) {
		if(null == m) {
			return;
		}
		String itemDirection = m.getItemDirection();
		SimpleDataDictionary simpleDataDictionary1 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), itemDirection, DataDicType.FUND_DIRECTION.getCode());
		m.setItemDirectionDisplay(simpleDataDictionary1 == null ? "" : simpleDataDictionary1.getName());
		
		String itemCode = m.getItemCode();
		SimpleDataDictionary simpleDataDictionary2 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), itemCode, DataDicType.FUND_ITEM.getCode());
		m.setItemCodeDisplay(simpleDataDictionary2 == null ? "" : simpleDataDictionary2.getName());
		
		String typeRemit = m.getTypeRemit();
		SimpleDataDictionary simpleDataDictionary3 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), typeRemit, DataDicType.SETTLEMENT_TYPE.getCode());
		m.setTypeRemitDisplay(simpleDataDictionary3 == null ? "" : simpleDataDictionary3.getName());
	}
}
